package com.qianfeng.project.activity;

import com.qianfeng.project.R;
import com.qianfeng.project.global.BaseActivity;
import com.qianfeng.tools.ActivityBack;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

/**
 * @author SAMSUNG
 * 城市列表
 *
 */
public class CityActivity extends BaseActivity {
	private ListView lv_city;

	@Override
	protected void onCreate(Bundle arg0) {
		// TODO Auto-generated method stub
		super.onCreate(arg0);
		setContentView(R.layout.activity_city);
		lv_city = (ListView) findViewById(R.id.lv_city);
		final String city[] = { "哈尔滨", "丽江", "大连", "西双版纳", "烟台", "威海", "杭州", "青岛", "九寨沟", "苏州", "厦门", "西安", "长白山", "三亚",
				"北京" };
		final String[] cityCode = { "0451", "0888", "0411", "0691", "0535", "0631", "0571", "0532", "0837", "0512",
				"0592", "029", "0439", "0898", "010" };
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1,
				city);
		lv_city.setAdapter(adapter);
		
		ActivityBack.getInstance(this);
		lv_city.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.putExtra("CITY", city[position]);
				intent.putExtra("CITYCODE", cityCode[position]);
				setResult(89, intent);
				finish();
			}
		});	

		
	}

}
